package com.zzh.partnersys.common.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author zzh
 * @version 1.0
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class BusinessException extends RuntimeException{
    //code编码
    private Integer code;

    /**
     * 业务异常构造函数
     * @param message
     * @param code
     */
    public BusinessException(String message, Integer code){
        super(message);
        this.code = code;
    }

    /**
     * 异常枚举类参数
     * @param resultCodeEnum
     */
    public BusinessException(ResultCodeEnum resultCodeEnum){
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }

    @Override
    public String toString() {
        return "zzhException{" +
                "code=" + code +
                ", message=" + this.getMessage() +
                '}';
    }

}
